package com.leve.admin.common;


import com.leve.admin.domain.ResultBase;

/**
 * Created by Jason on 2018/10/11.
 */
public class ResultUtil {
    /**
     * ！！！成功：code =0 ；提示有关用户信息
     *
     * @param code
     * @param msg
     * @param object
     * @return
     */
    public static ResultBase success(Integer code, String msg,String flag, Object object) {
        ResultBase result = new ResultBase();
        result.setStatus(code);
        result.setMsg(msg);
        result.setData(object);
        result.setFlag(flag);
        return result;
    }

    /**
     * code =-1 异常（后台系统异常，第三方调用异常，app端参数异常）
     *
     * @param code
     * @param msg
     * @return
     */
    public static ResultBase error(Integer code, String msg) {
        ResultBase result = new ResultBase();
        result.setStatus(code);
        result.setMsg(msg);
        // 默认为空
        result.setData(null);
        return result;
    }
}
